\(\int \frac {\cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx\) [260]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 19 \[ \int \frac {\cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {x}{a}+\frac {\cos (c+d x)}{a d} \]

[Out]

x/a+cos(d*x+c)/a/d

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {2761, 8} \[ \int \frac {\cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {\cos (c+d x)}{a d}+\frac {x}{a} \]

[In]

Int[Cos[c + d*x]^2/(a + a*Sin[c + d*x]),x]

[Out]

x/a + Cos[c + d*x]/(a*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2761

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[g*((g*Cos[e
 + f*x])^(p - 1)/(b*f*(p - 1))), x] + Dist[g^2/a, Int[(g*Cos[e + f*x])^(p - 2), x], x] /; FreeQ[{a, b, e, f, g
}, x] && EqQ[a^2 - b^2, 0] && GtQ[p, 1] && IntegerQ[2*p]

Rubi steps \begin{align*} \text {integral}& = \frac {\cos (c+d x)}{a d}+\frac {\int 1 \, dx}{a} \\ & = \frac {x}{a}+\frac {\cos (c+d x)}{a d} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(97\) vs. \(2(19)=38\).

Time = 0.10 (sec) , antiderivative size = 97, normalized size of antiderivative = 5.11 \[ \int \frac {\cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=-\frac {\cos ^3(c+d x) \left (2 \arcsin \left (\frac {\sqrt {1-\sin (c+d x)}}{\sqrt {2}}\right ) \sqrt {1-\sin (c+d x)}+(-1+\sin (c+d x)) \sqrt {1+\sin (c+d x)}\right )}{a d (-1+\sin (c+d x))^2 (1+\sin (c+d x))^{3/2}} \]

[In]

Integrate[Cos[c + d*x]^2/(a + a*Sin[c + d*x]),x]

[Out]

-((Cos[c + d*x]^3*(2*ArcSin[Sqrt[1 - Sin[c + d*x]]/Sqrt[2]]*Sqrt[1 - Sin[c + d*x]] + (-1 + Sin[c + d*x])*Sqrt[
1 + Sin[c + d*x]]))/(a*d*(-1 + Sin[c + d*x])^2*(1 + Sin[c + d*x])^(3/2)))

Maple [A] (verified)

Time = 0.15 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.00

method result size
parallelrisch \(\frac {d x +\cos \left (d x +c \right )-1}{a d}\) \(19\)
risch \(\frac {x}{a}+\frac {\cos \left (d x +c \right )}{a d}\) \(20\)
derivativedivides \(\frac {\frac {2}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}+2 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}\) \(35\)
default \(\frac {\frac {2}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}+2 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}\) \(35\)
norman \(\frac {\frac {x}{a}+\frac {x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a}+\frac {x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}+\frac {x \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}+\frac {2}{a d}+\frac {2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d a}+\frac {2 x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}+\frac {2 x \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}+\frac {2 \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}+\frac {2 \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}\) \(179\)

[In]

int(cos(d*x+c)^2/(a+a*sin(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/a/d*(d*x+cos(d*x+c)-1)

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.89 \[ \int \frac {\cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {d x + \cos \left (d x + c\right )}{a d} \]

[In]

integrate(cos(d*x+c)^2/(a+a*sin(d*x+c)),x, algorithm="fricas")

[Out]

(d*x + cos(d*x + c))/(a*d)

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 88 vs. \(2 (12) = 24\).

Time = 0.97 (sec) , antiderivative size = 88, normalized size of antiderivative = 4.63 \[ \int \frac {\cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\begin {cases} \frac {d x \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} + \frac {d x}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} + \frac {2}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} & \text {for}\: d \neq 0 \\\frac {x \cos ^{2}{\left (c \right )}}{a \sin {\left (c \right )} + a} & \text {otherwise} \end {cases} \]

[In]

integrate(cos(d*x+c)**2/(a+a*sin(d*x+c)),x)

[Out]

Piecewise((d*x*tan(c/2 + d*x/2)**2/(a*d*tan(c/2 + d*x/2)**2 + a*d) + d*x/(a*d*tan(c/2 + d*x/2)**2 + a*d) + 2/(
a*d*tan(c/2 + d*x/2)**2 + a*d), Ne(d, 0)), (x*cos(c)**2/(a*sin(c) + a), True))

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 52 vs. \(2 (19) = 38\).

Time = 0.28 (sec) , antiderivative size = 52, normalized size of antiderivative = 2.74 \[ \int \frac {\cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {2 \, {\left (\frac {\arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} + \frac {1}{a + \frac {a \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}}\right )}}{d} \]

[In]

integrate(cos(d*x+c)^2/(a+a*sin(d*x+c)),x, algorithm="maxima")

[Out]

2*(arctan(sin(d*x + c)/(cos(d*x + c) + 1))/a + 1/(a + a*sin(d*x + c)^2/(cos(d*x + c) + 1)^2))/d

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 34, normalized size of antiderivative = 1.79 \[ \int \frac {\cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {\frac {d x + c}{a} + \frac {2}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )} a}}{d} \]

[In]

integrate(cos(d*x+c)^2/(a+a*sin(d*x+c)),x, algorithm="giac")

[Out]

((d*x + c)/a + 2/((tan(1/2*d*x + 1/2*c)^2 + 1)*a))/d

Mupad [B] (verification not implemented)

Time = 2.37 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.53 \[ \int \frac {\cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {x}{a}+\frac {2}{a\,d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )} \]

[In]

int(cos(c + d*x)^2/(a + a*sin(c + d*x)),x)

[Out]

x/a + 2/(a*d*(tan(c/2 + (d*x)/2)^2 + 1))